package com.opages.platform.extension;


/**
 * 扩展点工厂类
 */
public class SpiExtensionFactory implements ExtensionFactory {

    @Override
    public <T> T getExtension(Class<T> clazz) {
        return ExtensionLoader.loadFile(clazz,null,null,null,null);
    }

    /**
     * SPI机制获取type接口扩展实现类
     * @param clazz object type.
     * @param name object name.
     * @param <T>
     * @return
     */
    public <T> T getExtension(Class<T> clazz, String name) {
        T extensionLoader = ExtensionLoader.loadFile(clazz,name,null,null,null);
        return extensionLoader;
    }

    @Override
    public <T> T getExtension(Class<T> clazz, String name, Class[] argTypes, Object[] args) {
        return ExtensionLoader.loadFile(clazz, name,null, argTypes,args);
    }

}
